home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / strip.doc < prev    next >
Text File  |  1995-03-31  |  3KB  |  86 lines

  1. (Comp.sys.handhelds) 
  2. Item: 3694 by Simone.Rapisarda at wolf.sublink.org 
  3. Author: [Simone Rapisarda] 
  4.   Subj: Re: CUT Program  [see CUT on this disk. -jkh] 
  5.   Date: Tue Jul 16 1991 
  6.  
  7. Some time ago I wrote a similar program, I called it STRIP. 
  8. I never posted it because I thought it was not so useful (and I  
  9. didn't like it very much) but maybe I was wrong so here it is.  
  10. I'm posting it because I think that it's more complete then CUT, 
  11. it cuts off more things, it works also on lists and doesn't need the  
  12. HACKIT library. 
  13.  
  14. All the operations are stack based so I think it's also faster. 
  15.  
  16. You can also run STRIP on programs containing 'Externals' without any  
  17. problem. In fact before exploding a program it checks if it's a 'real'  
  18. program or just an internal routine. 
  19.  
  20. I suggest you to use STRIP after PACK.  [PACK is on Goodies Disk #2. -jkh-] 
  21.  
  22. STRIP is a recursive program so don't change its name. 
  23.  
  24. It removes from PROGRAMS and LISTS the following things: 
  25.  
  26. - The instructions IF and UNTIL 
  27.  
  28. - The user program delimiters ( \<< and \>> ) and if the program contains 
  29.   only one object it cuts off all program delimiters. 
  30.  
  31. - All the \>> (the two types) and the END (the ones of the IF THEN [ ELSE ] 
  32.   END construct) that are at the end of the programs. 
  33.  
  34. I have tried STRIP with a lot of programs and everything worked fine  
  35. but I guarantee nothing so always backup your program before using  
  36. STRIP and test the STRIPped version before normal use. 
  37.  
  38.  
  39.                   Simple Example:  
  40.  
  41. before                                after  
  42.                      
  43. 15  \<<              
  44. 14  { \<< DUP \>> } 
  45. 13           (2349C: XLIB 1792 15) 
  46. 12  \<< SWAP \>> 
  47. 11  \->              
  48. 10  'a'                              10  { DUP }  ("47A2078BF1B2130")  
  49. 9   \<<                              9            (2349C: XLIB 1792 15)  
  50. 8   IF                               8   SWAP     (type 19) 
  51. 7   THEN                             7   \->  
  52. 6         (null program)             6   'a'      
  53. 5   ELSE                             5   \<<   
  54. 4         (null program)             4   THEN  
  55. 3   END                              3            (null program)  
  56. 2   \>>                              2   ELSE  
  57. 1   \>>                              1            (null program) 
  58.  
  59. I hope everything is clear. 
  60.  
  61.                                               RAP 
  62. ---------- 
  63.   Resp: 1 of 1 by bson at rice-chex.ai.mit.edu 
  64. Author: [Jan Brittenson] 
  65.   Date: Tue Jul 16 1991 
  66.  
  67. In a posting of [14 Jul 91 01:59:48 GMT] 
  68.    Simone.Rapisarda@wolf.sublink.org (Simone Rapisarda) writes: 
  69.  
  70.  > STRIP is a recursive program so don't change its name. 
  71.  > [Removes:] 
  72.  > 
  73.  > - The user program delimiters ( \<< and \>> ) and if the program contains 
  74.  >   only one object it cuts off all program delimiters. 
  75.  
  76. This is potentially dangerous. The sequence: 
  77.  
  78.         << X >> 'Y' STO 
  79.  
  80. Is quite different from the sequence: 
  81.  
  82.         X 'Y' STO 
  83.  
  84.                                                 -- Jan Brittenson 
  85.                                                    bson@ai.mit.edu 
  86.